﻿@model IEnumerable<HxBlogs.Model.Blog>
@if (Model != null)
{
    foreach (HxBlogs.Model.Blog blog in Model)
    {
        <div class="blog-item clearfix">
            <div class="blog-item-content">
                <div class="blog-item-title">
                    <h4>
                        <a target="_blank" href="@(WebHelper.GetFullUrl("/article/"+blog.UserName+"/"+Hx.Sdk.Common.Helper.Helper.ToHex(blog.Id)))">
                            @blog.Title
                        </a>
                    </h4>
                </div>
            </div>
            <div class="blog-item-summary hx-content-nowrap">
                <p>
                    @(WebHelper.FilterHtmlP(blog.ContentHtml, 150))
                </p>
            </div>
            <div class="blog-item-user d-flex justify-content-start align-items-center">
                <div class="ml-auto hx-text-gray">发布于@(WebHelper.GetDetailDate(blog.PublishDate))</div>
                <div class="ml-2">
                    <span class="hx-text-gray">阅读</span>
                    <span class="hx-text-blue">@blog.ReadCount</span>
                </div>
                <div class="ml-2">
                    <span class="hx-text-gray">评论</span>
                    <span class="hx-text-blue">@blog.CmtCount</span>
                </div>
                @if (UserContext.IsLoginUser(ViewBag.User))
                {
                    <div class="ml-2">
                        <a class="hx-a" data-id="@blog.HexId" data-url="/article/topblog" href="javascript:void(0)">@(blog.IsPersonTop ? "取消" : "")置顶</a>
                    </div>
                    <div class="ml-2">
                        <a class="hx-a" target="_blank" href="/edit/postedit/@blog.HexId">编辑</a>
                    </div>
                    <div class="ml-2">
                        <a class="hx-a" data-id="@blog.HexId" data-url="/article/deleteblog" href="javascript:void(0)">删除</a>
                    </div>
                }
            </div>
        </div>
    }
}